package com.itheima.mapper;

import com.itheima.domain.Orders;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrdersMapper {

    @Select("select * from orders where user_id=#{id}")
    @Results({
            @Result(id=true,property = "id",column = "id"),
            @Result(property = "number",column = "number"),
            @Result(property = "itemsList",column = "id",
                    javaType = List.class,
                    many=@Many(select = "com.itheima.mapper.ItemsMapper.findByUid")
            )


    })
   List<Orders> findByUid(int id);
}
